package wifi_locator_client.just.wzy.wifi_locator_client;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

/**
 * 第一个初始界面
 * Created by wzy on 15-4-11.
 */
public class StartActivity extends ActionBarActivity {

    private Button syncModeButton;
    private Button locationModeButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.start_layout);
        init();
    }


    /**
     * 控件初始化
     */
    private void init() {
        syncModeButton = (Button)findViewById(R.id.syncMode);
        locationModeButton = (Button)findViewById(R.id.locationMode);
        syncModeButton.setOnClickListener(new MyListener());
        locationModeButton.setOnClickListener(new MyListener());
    }

    /**
     * 内部类，空间监听
     */
    class MyListener implements OnClickListener {
        @Override
        public void onClick(View v) {
           switch (v.getId()){
               case R.id.syncMode:
                   Intent intent1 = new Intent(StartActivity.this, SyncActivity.class);
                   startActivity(intent1);
                   break;
               case R.id.locationMode:
                   Intent intent2 = new Intent(StartActivity.this, LocateActivity.class);
                   startActivity(intent2);
                   break;
           }
        }
    }
}
